package com.inossem.warehousestorage_inossem.request.refundStorage;

import android.content.Context;

import com.google.gson.Gson;
import com.inossem.warehousestorage_inossem.bean.refundStorage.RefundStorageAddOperatorUserGroupBean;
import com.inossem.warehousestorage_inossem.constant.Constant;
import com.inossem.warehousestorage_inossem.constant.RequestConstant;
import com.inossem.warehousestorage_inossem.listener.GsonBeanListener;
import com.inossem.warehousestorage_inossem.listener.StringRequestListener;
import com.inossem.warehousestorage_inossem.manage.RequestManage;
import com.inossem.warehousestorage_inossem.model.StringResponse;
import com.inossem.warehousestorage_inossem.request.Request;

/**
 * 作者：wsy on 2017/11/22 14:21
 * <p>
 * 邮箱：445979770@qq.com
 */

public class RefundStorageAddOperatorUserGroupRequest extends Request {

    public static String request(Context context, String type, GsonBeanListener gsonBeanListener) {
        String tag;
        String methodUrl = "";
        switch (type) {
            case Constant.GET_USER_GROUP_REFUND_STORAGE_PICKING:
                methodUrl = RequestConstant.URL_REFUND_STORAGE_PICKING_GET_USER_GROUP;
                break;
            case Constant.GET_USER_GROUP_REFUND_STORAGE_SALE:
                methodUrl = RequestConstant.URL_REFUND_STORAGE_SALE_GET_USER_GROUP;
                break;
            case Constant.GET_USER_GROUP_REFUND_STORAGE_RESERVED:
                methodUrl = RequestConstant.URL_REFUND_STORAGE_RESERVED_GET_USER_GROUP;
                break;
        }
        String url = RequestManage.getUrl(context, methodUrl);
        tag = RequestManage.getHttpsGetWithLoading(context, url, new StringRequestListener() {
            @Override
            public void onSuccess(StringResponse stringRequestResponse) {
                Gson gson = new Gson();
                RefundStorageAddOperatorUserGroupBean bean = gson.fromJson(stringRequestResponse.getResponseInfo(), RefundStorageAddOperatorUserGroupBean.class);
                excuteJsonBean(context, bean, bean.getCode(), bean.getMsg(), gsonBeanListener);
            }
        });
        return tag;
    }
}
